#include<iostream>
#include<math.h>
using namespace std;
int main() {
	int a, b, c, d = 0;
	int s[10];
	cin >> a;
	for (b = 0; b < a; b++) {
		cin >> s[b];
	}
	for (b = 0; b < a; b++) {
		for (c = 0; c < a; c++) {
			if (b != c)
				d += s[b] * 10 + s[c];
		}
	}
	cout << d;
	return 0;
}